import request from '@/utils/request'

// 查询运行设备列表
export function listDevice(query) {
  return request({
    url: '/app/device/list',
    method: 'get',
    params: query
  })
}

export function listSimple(query) {
  return request({
    url: '/app/device/list/simple',
    method: 'get',
    params: query
  })
}
// 查询运行设备列表（排除节点）
export function listDeviceExcludeChild(deviceId) {
  return request({
    url: '/app/device/list/exclude/' + deviceId,
    method: 'get'
  })
}
// 查询运行设备管理员
export function listAdmin(deviceId) {
  return request({
    url: '/app/device/list/admin/' + deviceId,
    method: 'get'
  })
}
// 查询运行设备操作员
export function listOperator(deviceId) {
  return request({
    url: '/app/device/list/operator/' + deviceId,
    method: 'get'
  })
}
// 查询运行设备详细
export function getDevice(deviceId) {
  return request({
    url: '/app/device/' + deviceId,
    method: 'get'
  })
}

// 新增运行设备
export function addDevice(data) {
  return request({
    url: '/app/device',
    method: 'post',
    data: data
  })
}

// 修改运行设备
export function updateDevice(data) {
  return request({
    url: '/app/device',
    method: 'put',
    data: data
  })
}

// 删除运行设备
export function delDevice(deviceId) {
  return request({
    url: '/app/device/' + deviceId,
    method: 'delete'
  })
}

// 设备数据权限
export function dataScope(data) {
  return request({
    url: '/app/device/dataScope',
    method: 'put',
    data: data
  })
}

// 设备空间权限
export function placeScope(data) {
  return request({
    url: '/app/device/placeScope',
    method: 'put',
    data: data
  })
}

// 根据设备ID查询部门树结构
export function deptTreeSelect(deviceId) {
  return request({
    url: '/app/device/deptTree/' + deviceId,
    method: 'get'
  })
}

// 根据设备ID查询空间树结构
export function placeTreeSelect(deviceId) {
  return request({
    url: '/app/device/placeTree/' + deviceId,
    method: 'get'
  })
}

// 复制运行设备详细
export function copyDevice(deviceId, num) {
  return request({
    url: '/app/device/copy?deviceId=' + deviceId+"&num=" + num,
    method: 'get'
  })
}



